package edu.suda.xsap.service.impl;
import edu.suda.xsap.dto.Statistics_chargeDto;
import edu.suda.xsap.dto.convert.Statistics_chargeConvert;
import edu.suda.xsap.entity.Statistics_charge;
import edu.suda.xsap.mapper.Statistics_chargeMapper;
import edu.suda.xsap.service.Statistics_chargeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.Month;
import java.time.Year;

import java.util.List;

@Service
public class Statistics_chargeServiceImpl implements Statistics_chargeService {

    @Autowired
    private Statistics_chargeConvert statistics_chargeConvert;

    @Autowired
    private Statistics_chargeMapper statistics_chargeMapper;

    @Override
    public List<Statistics_chargeDto> findMONTH(Year year) {
        //
        List<Statistics_charge> statistics_charges = statistics_chargeMapper.findMONTH(year);
        //要把这个List<s_c>转换成List<s_cDto>
        return statistics_chargeConvert.toDtoList(statistics_charges);
    }

    @Override
    public List<Statistics_chargeDto> findYEAR(Year year1, Year year2) {
        //
        List<Statistics_charge> statistics_charges = statistics_chargeMapper.findYEAR(year1,year2);
        //要把这个List<s_c>转换成List<s_cDto>
        return statistics_chargeConvert.toDtoList(statistics_charges);
    }

    @Override
    public List<Statistics_chargeDto> findQUARTER(Year year) {
        //
        List<Statistics_charge> statistics_charges = statistics_chargeMapper.findQUARTER(year);
        //要把这个List<s_c>转换成List<s_cDto>
        return statistics_chargeConvert.toDtoList(statistics_charges);
    }

}
